/**
 * Created by 白雨浓 on 17-8-10 下午2:55.
 *
 * 拦截器
 */
import router from '../router'
import axios from 'axios'

const DEFAULT_PATH = '/login';

const Filter = {
    install(Vue) {

        /** 修改title*/
        const changeTitle = (to) => {
            if (to.meta.title !== undefined)
                document.title = to.meta.title;
        };

        /** 拦截器*/
        let filter = async (to, next) => {
            window.scrollTo(0, 0);
            next();
        };

        router.beforeEach(async (to, from, next) => {
            changeTitle(to);
            await filter(to, next);
        });

        router.afterEach(() => {
        })
    }
};

export default Filter;
